The present invention relates to a position detection apparatus. More specifically, this invention relates to a position detection apparatus in which data representing a position of an object to be measured is calculated from an output of a sensor for detecting a position of the object.
Among position detection apparatus, there are some apparatuses in which data representing a position of an object to be measured is calculated from an output of a sensor, that is, some (not negligible) time is required for obtaining position data from the output of the sensor.
FIG. 10 shows one example of such a conventional position detection apparatus. This position detection apparatus 110 is a so-called optical rotary encoder, which is a type connected to a motor controller 132 by a serial transmission line 131.
As shown in this figure, the position detection apparatus 110 comprises a light-emitting circuit 111, a photo-detecting circuit 112, a scale disc 113 and an amplifier 114. The position detection apparatus 110 also comprises a sample holding section 115, a multiplexer 116, an A/D converter 117, a microcomputer 18, a serial signal conversion circuit 119, and a serial signal transmission circuit 120.
The light-emitting circuit 111 is a circuit including light emission elements 121, M in number (M is a plural number). The photo-detecting circuit 112 is a circuit including photodetectors 122, M in number, which convert light from the light emission elements 121 in the light-emitting circuit 111 to electric signals (analog signals), respectively. The scale disc 113 (also referred to as a slit disc or a code-disc) is turntable machined so that the intensity of light incident on the photodetectors 122 in the photo-detecting circuit 112 changes, and by means of the rotation of this scale disc 113, M sine-wave signals or triangular wave signals having different periods or phases are output from the M photodetectors 122 in the photo-detecting circuit 112. Sine-wave signals can be output when a scale disc 133 with a sine-wave slit is used. However, sine-wave signals can be output even when a rectangular slit is used. Because, when a rectangular slit is used, a substantially sine-wave signal (pseudo sine-wave signal) can be obtained due to the diffraction effect of the light. The scale disc 133 is generally attached to a rotation shaft of a motor which is controlled by the motor controller 132.
The amplifier 114 is a circuit for amplifying the output of each photodetector 122 in the photo-detecting circuit 112. That is to say, the amplifier 114 is a circuit for outputting manalog signals. The sample holding section 115 includes M sample holding circuits respectively connected to M amplifying circuits in the amplifier 114. All the sample holding circuits in the sample holding section 115 are supplied with the sample holding signals from the microcomputer 118. That is to say, the sample holding section 115 simultaneously holds M signals which change time-wise, output from the amplifying circuit 114, when a sample holding signal instructing the holding operation is input, and subsequently continues to output the held M signals.
The multiplexer 116 outputs a signal instructed by the microcomputer 118, among M signals output from the sample holding section 115. The A/D converter 117 converts the analog signal output from the multiplexer 116 to a digital signal, and the control of the operation timing of the A/D converter 117 is also performed by the microcomputer 118.
The serial signal conversion circuit 119 converts a parallel signal from the microcomputer 118 to a serial signal, and supplies the serial signal to the serial signal transmission circuit 120. The serial signal conversion circuit 119 also performs a processing which is reverse to this. When a predetermined signal is supplied from the serial signal transmission circuit 120 (when a request signal is received by the serial signal transmission circuit 120, and a signal corresponding to the request signal is supplied from the serial signal transmission circuit 120), the serial signal conversion circuit 119 outputs a signal for informing the microcomputer 118 of this matter.
The serial signal transmission circuit 120 is an interface circuit with the motor controller 132. The serial signal transmission circuit 120 prepares a transmission signal by subjecting the serial signal provided by the serial signal conversion circuit 19 to a predetermined processing (calculation of CRC, addition of start bit and stop bit, or the like), and supplies the prepared transmission signal to the motor controller 132 via the serial transmission line 131. The serial signal transmission circuit 120 also performs a processing for preparing a serial signal corresponding to the transmission signal received from the motor controller 132.
The microcomputer 118 is a control circuit of the position detection apparatus 110. The microcomputer 118 includes an input circuit 123, an output circuit 124, a CPU 125 and a timer 126, and the output of the A/D converter 117 is supplied to the CPU 125 via the input circuit 124. The sample holding signal is output from the output circuit 125 under the control of the CPU 125. The serial signal conversion circuit 119 is connected to the CPU 125.
Moreover, though not shown, the position detection apparatus 110 is provided with a circuit for detecting that the scale disc 113 has made one revolution from the output of a specific photodetector 122 in the photo-detecting circuit 112, and a multi-turn counter for counting how many revolutions the scale disc 113 has made based on the detection result of the circuit, and the multi-turn counter is also connected to the CPU 125.
The overall operation of the position detection apparatus 110 will now be described, with reference to FIG. 10 and FIG. 11. In FIG. 11, (A) illustrates a timing for the position detection apparatus 110 to receive a request signal from the motor controller 132, (B) illustrates the time change in a value of a timer 126 in the microcomputer 118. (C) illustrates the time change in the sample holding signal output from the microcomputer 118 to the sample holding section 115, and (D) illustrates the time change in the contents of processing executed by the CPU 125. Finally, (E) illustrates the timing when a position signal is transmitted from the position detection apparatus 110.
The position detection apparatus 110 is an apparatus which supplies a position signal holding position data representing the position of the scale disc 113 at the time when it receives a request signal from the motor controller 132 via the serial transmission line 131, as a response to the request signal, via the serial transmission line 131 to the motor controller 132.
The position data handed over to the motor controller 132 comprises 2-byte data showing how many turns the scale disc 113 has made until then, and 2-byte data related to the angle of rotation of the scale disc 113. The former data is obtained from the multi-turn counter, and hence required data related to the time can be obtained immediately. The data related to the angle of rotation, however, is calculated by numerical operation based on the output of the photo-detecting section 112, and hence, relatively long period of time is required for the completion of processing to obtain the data. Accordingly, if it is so constructed that the processing is to be started at the time of reception of the request signal, the position data representing the position of the slit disc 113 at the time when the request signal is transmitted is received, after a while after the transmission of the request signal.
From the view point of the motor controller side, it is convenient that the position data representing the position of the scale disc 113 can be obtained at the time when the request signal is transmitted. Hence, with this position detection apparatus 110, the position data handed over to the motor controller 132 at the time of reception of the request signal is generally obtained before reception of the request signal. A position detection apparatus in which the position data related to the transmission time is calculated (presumed) from the position data derived from the measurement value is known. In this apparatus the position data is transmitted before reception of the next request signal.
Precisely, the CPU 125 in the position detection apparatus 110 clears the timer 126 to be 0, every time it is detects that the request signal is received, as shown in FIG. 11 (A) and (B). Then, the CPU 125 starts processing for obtaining the position data, when the value of the timer 126 becomes TMSET. Here, TMSET is data given to the CPU 125 beforehand.
For example, if it is assumed that the time when the request signal is received is time tb, the CPU 125 starts processing for obtaining the position data at time tc after time TMSET has passed since time tb.
As schematically shown in FIGS. 11 (C) and (D), at the time of this processing, the CPU 125 designates the sample holding signal as xe2x80x9cLxe2x80x9d, to thereby have the sample holding section 115 hold M signals which are being output from the amplifying section 114. Then, the CPU 125 performs control of the A/D converter 117 or the like, to obtain M data corresponding to the output of the M photodetectors. The CPU 125 then returns the sample holding signal to xe2x80x9cHxe2x80x9d (high logical level), and calculates the position data DT0 at time tb when the sample holding signal is designated as xe2x80x9cLxe2x80x9d (low logical level) (when the hold command is given to the A/D converter 117), from the obtained M data and the value of the multi-turn counter. In this processing, Mxe2x80x2 (in this apparatus, Mxe2x80x2=16) bit data representing the angle of rotation are obtained from the M data. Data comprising the data and the multi-turn counter value are designated as the position data DT0.
The CPU 125 then performs calculation expressed with the following expression (hereinafter, referred to as correction expression), in order to obtain transmission position data SD0 which is position data to be informed to the motor controller 132 as a response to the request signal to be received thereafter.
SD0DT0+(SDxe2x88x921xe2x88x92SDxe2x88x922)xc3x97(TMRQxe2x88x92TMSET)/TMRQ
Here, SDxe2x88x921 and SDxe2x88x922 are respectively transmission position data calculated (transmitted) last time and the last but one. TMRQ is data given to the CPU 125 beforehand, as a period of the request signal output from the motor controller 132 connected to the position detection apparatus 110.
The CPU 125 then supplies the calculated SD0 to the serial signal transmission circuit 120 via the serial signal conversion circuit 119, when the request signal is received in a later stage, and as a result, the position signal holding SD0 is transmitted on the serial transmission line 131 (see FIG. 11 (E)).
Here, the reason why the transmission position data SD0 is obtained from the above-described correction expression will be described in brief.
With this position detection apparatus 110, the time tc when the hold command is issued is a time after time TMSET has passed since the reception time tb of the request signal, and the time when the next request signal is to be received should be time td after time TMRQ has passed since the time tb. Accordingly, if it is assumed that the change rate (variation per unit time) of the position of the scale disc 113 between time tc and td is V, the transmission position data SD0 to be transmitted at the time of reception of the next request signal is expressed by the following expression:                               SD          0                =                  xe2x80x83                ⁢                              DT            0                    +                                    (                                                t                  d                                -                                  t                  c                                            )                        xc3x97            V                                                  =                  xe2x80x83                ⁢                              DT            0                    +                                    (                                                TM                  RQ                                -                                  TM                  SET                                            )                        xc3x97                          V              .                                          
If it is assumed that V is equal to the change rate of the position of the scale disc 113 between time ta and tb (that is, (SDxe2x88x921xe2x88x92SDxe2x88x922)/TMRQ), the above-described correction expression is fulfilled. Hence, with the position detection apparatus 110, SD0 is calculated from the correction expression.
Since the conventional position detection apparatus 110 operates as described above, if the period of the request signal from the motor controller 132 exactly coincides with TMRQ, when the request signal is received, the position data representing the position of the scale disc 113 at that time can be informed to the motor controller.
If the position detection apparatus is connected for use to a motor controller having the period IRQ of the request signal different from TMRQ, when the request signal is received, the position detection apparatus 110 cannot inform the motor controller of the position data representing the position of the scale disc 113 at that time. Because, the transmission position data calculated by the CPU 125 is the position data representing the position of the scale disc 113 at the time when time TMRQ has passed since reception of the last request signal, and is not data at the time when time IRQ has passed.
That is to say, the conventional position detection apparatus 110 cannot be used in combination with other motor controllers having different request signal periods, or cannot be used in combination with motor controllers which change the request signal period by itself.
Moreover, in ordinary motor controllers, the transmission timing of the request signal is controlled by hardware and software. That is to say, transmission of request signals, once in several times, is performed in the manner synchronized with the signal having exact period output from the hardware, and transmission of other request signals is in many cases timing-controlled by the software. When the position detection apparatus 110 is connected to such a motor controller, the interval of the request signal input to the position detection apparatus 110 varies. When the interval of the request signal varies, as is obvious from the above-described operation procedure, the conventional position detection apparatus 110 outputs erroneous transmission position data, hence there may be a case where control of the motor is not performed properly.
Moreover, to improve the ability of the motor to a response, it is desired that position data having high precision (having many number of bits) can be supplied to the motor controller in a short period. In particular, with the synchronous motor, the position of the magnetic pole of a permanent magnet used for the field magnet changes at high speed during high-speed rotation, hence it is required that the position of the magnetic pole can be informed to the motor controller in a short period.
With the conventional position detection apparatus 110, however, the period in which the position data can be supplied to the motor controller 132 is limited by the transmission time of the position signal determined by the number of bits of the transmission position data, or by the time required for calculation of the transmission position data. As a result, there may be a case where the position detection apparatus cannot properly perform control of the motor or the like.
Specifically, the position detection apparatus 110 is an apparatus which transmits signals of 7 frames in total, as shown in FIG. 12, comprising a control signal (CD) 801, 4-byte transmission position data signals (SD0) 902, an alarm signal (ALM) 903, and a cyclic redundancy check signal (CRC) 904, as position signals, to the motor controller 132. Here, the frame shown on the left side in the figure is first transmitted.
Since one frame is formed by adding a start bit and a stop bit in front and back of the byte data to be transmitted, the total number of bits of this signal becomes 70 bits as shown in the figure. When the transfer speed for serial communication is 2.5 Mbps, the time required for the transmission of the 70-bit signal becomes 28 xcexcs (=70/(2.5xc3x97106)). Therefore, the position detection apparatus 110 cannot inform the motor controller 132 of the position data in a period shorter than this time. If the data transfer speed of the serial communication is increased, the period can be shortened, but since the signal becomes dull on the serial transmission line, it is actually impossible to increase the transfer speed than the current speed.
Moreover, since the time required for calculation of the transmission position data is a time in the same order as that required for transmission of the position signal, as shown schematically in FIG. 11. Hence, when the motor or the like is controlled using the conventional position detection apparatus 110, there is a case where the position data cannot be obtained in a period required for the control, depending on the control contents.
It is therefore an object of the present invention to provide a position detection apparatus which can properly control an apparatus to be controlled, such as a motor or the like for moving the position of an object to be measured.
The position detection apparatus according to the present invention comprises a detection unit which detects reception of a request signal which requests output of the position data; a sensor output measurement unit which measures the output of a sensor for detecting the position of an object to be measured, when a predetermined time has passed since reception of the request signal was detected by the detection unit; a position data calculation unit which calculates the position data representing the position of the object at a point of time when the measurement was performed, based on the output measured by the sensor output measurement unit; a corrected position data calculation unit which calculates corrected position data which is position data representing the position of the object at the time of receiving the request signal, using a value obtained by subtracting the predetermined time from the reception interval of the request signal, position data calculated by the position data calculation unit, and a presumed speed of the object; and an output unit which outputs the corrected position data calculated by the corrected position data calculation unit as a response to the request signal.
That is to say, with the position detection apparatus according to the present invention, when the position data (corrected position data) at the time of reception of the request signal is calculated (presumed), based on the position data related to a certain time calculated based on the output of the sensor, the elapsed time from that time till the request signal has been actually received is used. Accordingly, even if the reception period of the request signal changes, the position detection apparatus can output accurate position data, and if this position detection apparatus is used, accurate position data related to the object can be obtained in a desired frequency. As a result, with this position detection apparatus, an apparatus to be controlled (e.g. a motor) which changes the position of the object can be controlled more appropriately.
Moreover, the position detection apparatus according to the present invention comprises a detection unit which detects reception of a request signal for requesting output of the position data; a measurement processing execution unit which executes measurement of the sensor output for detecting a position of an object to be measured, every time multiples of time of an output period given in advance, being a period of an integral fraction of a period of the request signal, has passed, after a predetermined time has passed since the detection of the request signal, every time the reception of the request signal is detected by the detection unit; a position data calculation unit which calculates position data representing the position of the object at a point of time when measurement is performed, using a measured output, every time the output of the sensor is measured by the measurement processing execution unit; a corrected position data calculation unit which calculates the corrected position data, being position data representing the position of the object at a point of time first reached after measurement of the output by the sensor output measurement unit, which is a point of time when multiples of time of the output period has passed since the reception of the request signal, using a calculated position data, every time the position data is calculated by the position data calculation unit, the output period, the predetermined time and change rate of a presumed position of the object; and a corrected position data output unit which outputs the calculated corrected position data, every time the corrected position data is calculated by the corrected position data calculation unit, at a time when the corrected position data is representing a position.
That is to say, with the position detection apparatus according to the present invention, calculation and transmission of the corrected position data are performed in the previously given output period, while sometimes being synchronized with the request signal. Therefore, if this position detection apparatus is combined with the equipment which transmits only a request signal having an accurate period which is time-controlled by the hardware (for example, motor controller), it is possible to minimize the adverse effect on the control of an apparatus to be controlled due to difference in the reception interval of the request signal.
Moreover, when the position detection apparatus according to the present invention is realized, the position detection apparatus may be added with a monitoring unit which monitors the change rate of a position of the object and an output period change unit which changes a value of the output period to other values which are an integral fraction of a period of the request signal, depending on the monitoring result of the monitoring unit. When the monitoring unit is added, a bit length change unit which changes the bit length of the position data calculated by the position data calculation unit depending on the monitoring result of the monitoring unit may be also added.
By using the position detection apparatus according to the present invention, added with the monitoring unit or the like, it becomes possible to perform control of an apparatus to be controlled which is changing the position of the object in an environment depending on the change rate of the position of the object, thereby enabling appropriate control of the apparatus to be controlled.
Furthermore, when the position detection apparatus according to the present invention is realized, the position detection apparatus may be added with an output period change unit which changes a value of the output period to other values which are an integral fraction of a period of the request signal, depending on the assignment information included in the request signal detected by the detection unit.
That is to say, the position detection apparatus may be constructed such that the value of the output period is changed in response to the instruction from the equipment to be connected.
Also, the position detection apparatus according to the present invention comprises a detection discrimination unit which detects reception of a request signal for requesting an output of the position data, and discriminating whether the request signal whose reception has been detected is a first class request signal or a second class request signal; a measurement processing execution unit which executes processing for measuring the output of a sensor for detecting the position of the object, every time multiples of time of a period of the request signal given in advance has passed, after a predetermined time has passed since the reception detection of the first class request signal, every time the reception of the first class request signal is detected by the detection discrimination unit; a position data calculation unit which calculates position data representing the position of the object at a point of time when measurement is performed, using a measured output, every time the output of the sensor is measured by the measurement processing execution unit; a corrected position data calculation unit which calculates the corrected position data, being position data representing the position of the object at a point of time first reached after measurement of the output by the sensor output measurement unit, which is a point of time when multiples of time of the period has passed since the reception of the first class request signal, using the position data, every time the position data is calculated by the position data calculation unit, the period, the predetermined time and change rate of a presumed position of the object; and a corrected position data output unit which outputs the calculated corrected position data, every time the corrected position data is calculated by the corrected position data calculation unit, after the calculation, as a response to the first class request signal or the second class request signal whose reception has been detected by the detection discrimination unit.
That is to say, with the position detection apparatus according to the present invention, the first class request signal is used as a signal for deciding the timing for starting a processing for obtaining the corrected position data, and a signal for deciding the timing for executing the data output (transmission). On the other hand, the second class request signal is used only as a signal for deciding the timing for performing data output, and the start timing of the processing for obtaining the corrected position data output at the time of data output is decided based on the reception time of the first request signal.
Accordingly, if the position detection apparatus is combined with another equipment (e.g. motor controller) which outputs the first request signal at the time of outputting the request signal controlled by the hardware control and outputs the second request signal at the time of outputting the request signal controlled by the software control, even if the transmission timing of the request signal varies in the equipment, control itself of the apparatus to be controlled (e.g. motor) which is changing the position of the object can be performed without any problem.
When the position detection apparatus according to the present invention is realized, the position detection apparatus may be added with a transmission unit which transmits a signal having a first predetermined number of bits representing corrected position data, on a serial transmission line to which the equipment for outputting the request signal is connected, as a detection result, with regard to the corrected position data first output by the corrected position data output unit, and a signal having a second predetermined number of bits, which is smaller than the first predetermined number of bits, representing a difference between the corrected position data and corrected position data output last time, on the serial transmission line, as a detection result, with regard to the corrected position data output for the second time and after by the corrected position data output unit.
If the position detection apparatus added with this transmission unit is combined with an apparatus which stores the corrected position data represented by the first input signal as the absolute position data, adds data represented by the signal input after that to the absolute position data, and handles the absolute position data after the addition as data representing the position of an object at that point of time, and also controls the object directly or indirectly (e.g. motor controller), the time required for transmission of the corrected position data can be further shortened. That is to say, the acquisition frequency of the corrected position data can be increased, and as a result, the apparatus to be controlled (e.g. motor) can be controlled more appropriately.